package com.aspose.cells;

import java.util.ArrayList;

class zady {
   private zaeh a = null;
   private Style b = null;

   zady(zaeh var1) {
      this.a = var1;
      this.b = this.a.h();
   }

   void a(zafg var1) throws Exception {
      var1.a("tr");
      var1.b(" {mso-height-source:auto;");
      var1.b(" mso-ruby-visibility:none;}");
      var1.b("col");
      var1.b(" {mso-width-source:auto;");
      var1.b(" mso-ruby-visibility:none;}");
      var1.b("br");
      var1.b(" {mso-data-placement:same-cell;}");
      var1.b("ruby");
      var1.b(" {ruby-align:left;}");
      this.b(var1);
      this.c(var1);
      this.d(var1);
      this.e(var1);
      var1.h();
   }

   private void b(zafg var1) throws Exception {
      Style var2 = this.b;
      var1.b(".style0");
      var1.b(" {");
      this.a(var1, var2, true);
      this.d(var1, var2);
      this.a(var1, var2);
      this.a(var1, var2.getFont(), true);
      this.e(var1, var2);
      this.c(var1, var2);
      var1.b(" mso-style-name:Normal;");
      var1.b(" mso-style-id:0;}");
   }

   private void c(zafg var1) throws Exception {
      ArrayList var2 = this.a.e().a;

      for(int var3 = 0; var3 < var2.size(); ++var3) {
         Font var4 = (Font)var2.get(var3);
         var1.b(".font" + zase.y(var3));
         var1.b(" {");
         this.a(var1, var4, true);
         var1.a(" }");
      }

   }

   private void d(zafg var1) throws Exception {
      Style var2 = this.b;
      var1.b("td");
      var1.b(" {mso-style-parent:style0;");
      this.a(var1, var2, true);
      this.d(var1, var2);
      this.a(var1, var2);
      this.a(var1, var2.getFont(), true);
      this.e(var1, var2);
      this.c(var1, var2);
      var1.b(" mso-ignore:padding;}");
   }

   private void e(zafg var1) throws Exception {
      zbvx var2 = this.a.g.getWorksheets().B();

      for(int var3 = 0; var3 < var2.getCount(); ++var3) {
         Style var4 = var2.a(var3);
         this.a(var1, var4, var3);
      }

   }

   void a(zafg var1, Style var2, int var3) throws Exception {
      if (!var2.g()) {
         var1.b(".style" + zase.y(var3));
      } else {
         var1.b("." + this.a.c().getCellCssPrefix() + "x" + zase.y(var3));
      }

      var1.b(" {");
      String var4;
      if (var2.g()) {
         var4 = " mso-style-parent:style0;";
         if (var2.h() > 0) {
            var4 = " mso-style-parent:style" + zase.y(var2.h()) + ";";
         }

         var1.b(var4);
      }

      this.a(var1, var2, var2.g());
      this.d(var1, var2);
      this.a(var1, var2);
      if (var2.q() != null) {
         this.a(var1, var2.getFont(), false);
      }

      if (var2.d() != null) {
         this.e(var1, var2);
      }

      this.c(var1, var2);
      if (!var2.g()) {
         var4 = var2.getName();
         if (var4 != null && var4.length() > 0) {
            var1.b(" mso-style-name:\"" + var4.trim() + "\";");
         }
      }

      var1.b(" }");
   }

   private void c(zafg var1, Style var2) throws Exception {
      var1.b(" mso-protection:" + (var2.isLocked() ? "locked " : "unlocked ") + (var2.isFormulaHidden() ? "hidden" : "visible") + ";");
   }

   private void a(zafg var1, Style var2, boolean var3) throws Exception {
      String var4 = var2.getCustom();
      if ((var4 == null || var4.length() == 0) && var2.getNumber() > 0) {
         var4 = var2.e().n().getSettings().e().d(var2.getNumber());
      }

      if (var4 != null && var4.length() > 0) {
         var4 = zaff.g(var4);
         var1.b(" mso-number-format:\"" + com.aspose.cells.b.a.zr.a(var4) + "\";");
      } else if (var3) {
         var1.b(" mso-number-format:General;");
      }

   }

   private void d(zafg var1, Style var2) throws Exception {
      var1.b(" " + zaff.b(var2.getHorizontalAlignment()) + ";");
      var1.b(" " + zaff.c(var2.getVerticalAlignment()) + ";");
      if (var2.isTextWrapped()) {
         var1.b(" white-space:normal;word-wrap:break-word;");
      } else {
         var1.b(" white-space:nowrap;");
      }

      if (var2.getIndentLevel() > 0) {
         var1.b(" mso-char-indent-count:" + zase.y(var2.getIndentLevel()) + ";");
         int var3 = this.a(var2);
         char var4 = zaff.b(var2.getHorizontalAlignment()).charAt(11);
         if (var4 == 'l') {
            var1.b(" padding-left:" + zase.y(var3) + "px;");
         } else if (var4 == 'r') {
            var1.b(" padding-right:" + zase.y(var3) + "px;");
         }
      }

      if (var2.getRotationAngle() == 255) {
         var1.b(" layout-flow:vertical;");
      } else if (var2.getRotationAngle() != 0) {
         var1.b(" mso-rotate:" + zase.y(var2.getRotationAngle()) + ";");
      }

   }

   private int a(Style var1) throws Exception {
      int var2 = this.a.d().a(var1, "O");
      return var2 * var1.getIndentLevel();
   }

   public void a(zafg var1, Style var2) throws Exception {
      String var3 = "auto";
      String var4 = "auto";
      String var5 = "";
      switch(var2.getPattern()) {
      case 0:
         break;
      case 1:
         if (!var2.b.a()) {
            var3 = "#" + zase.a(var2.getForegroundColor());
         }

         var5 = " none";
         break;
      default:
         if (!var2.a.a()) {
            var3 = "#" + zase.a(var2.getBackgroundColor());
         }

         if (!var2.b.a()) {
            var4 = "#" + zase.a(var2.getForegroundColor());
         }

         var5 = " " + zsl.b(var2.getPattern());
      }

      var1.b(" background:" + var3 + ";");
      var1.b(" mso-pattern:" + var4 + var5 + ";");
   }

   private void a(zafg var1, Font var2, boolean var3) throws Exception {
      if (!var2.b.a() || var3) {
         var1.b(" color:#" + zase.a(var2.getColor()) + ";");
      }

      var1.b(" font-size:" + zase.y(var2.getSize()) + "pt;");
      var1.b(" font-weight:" + zase.y(var2.g()) + ";");
      if (var2.isItalic()) {
         var1.b(" font-style:italic;");
      } else {
         var1.b(" font-style:normal;");
      }

      if (var2.isStrikeout()) {
         var1.b(" text-decoration:line-through;");
      }

      if (var2.getUnderline() != 0) {
         var1.b(" " + zaff.a(var2.getUnderline()));
      }

      if (var2.h() != 0) {
         var1.b(" font-family:\"" + var2.getName() + "\",");
         switch(var2.h()) {
         case 1:
            var1.a("\"serif\";");
            break;
         case 2:
            var1.a("\"sans-serif\";");
            break;
         case 3:
            var1.a("\"monospace\";");
            break;
         case 4:
            var1.a("\"cursive\";");
            break;
         default:
            var1.a("\"sans-serif\";");
         }
      } else {
         var1.b(" font-family:\"" + var2.getName() + "\";");
      }

   }

   private void e(zafg var1, Style var2) throws Exception {
      if (var2.f()) {
         this.b(var1, var2);
      } else {
         var1.b(" border:none;");
      }

   }

   void b(zafg var1, Style var2) throws Exception {
      var1.b(" border-top:" + zaff.a(var2, 4, true) + ";");
      var1.b(" border-right:" + zaff.a(var2, 2, true) + ";");
      var1.b(" border-bottom:" + zaff.a(var2, 8, true) + ";");
      var1.b(" border-left:" + zaff.a(var2, 1, true) + ";");
      var1.b(" mso-diagonal-down:" + zaff.a(var2, 16, true) + ";");
      var1.b(" mso-diagonal-up:" + zaff.a(var2, 32, true) + ";");
   }
}
